/**
 * 整车平台---修改设计的JS文件
 */

$(document).ready(function(){
	nowColorControl();//车身颜色选择
	editControl();//整车名称编辑修改按钮
	rightFormSubmit();//右侧细节设置修改提交
});

function nowColorControl(){
	var $body = $(document.body);
	
	$(".rightForm-carColor").on("click",function(){
		var thisItem=$(this);
		if(!(thisItem.hasClass("nowColor"))){
			thisItem.addClass("nowColor");
			thisItem.siblings().removeClass("nowColor");
		}
	});
	
	/*$("#carSideBlack").click(function(){
		 $body.attr('class','client-body clm-body blackActive');
	});
	$("#carSideWhite").click(function(){
		 $body.attr('class','client-body clm-body whiteActive');
	});
	$("#carSideRed").click(function(){
		 $body.attr('class','client-body clm-body redActive');
	});
	$("#carSideBlue").click(function(){
		 $body.attr('class','client-body clm-body blueActive');
	});*/
}

function editControl(){
	$("#carNameEdit").on("click",function(){
		var thisItem=$(this);
		var itemParent=thisItem.parent();
		
		itemParent.css("display","none");
		itemParent.next().css("display","block");
		
		var carName=$("#carName").text();
		$("#carNameInput").val(carName);
	});
	
	$("#carNameSure").on("click",function(){
		var thisItem=$(this);
		var itemParent=thisItem.parent();
		
		itemParent.css("display","none");
		itemParent.prev().css("display","block");
		
		var carNameInput=$("#carNameInput").val();
		$("#carName").text(carNameInput);
	});
}

function rightFormSubmit(){
	$("#formSubmit").click(function(){
		$("#carModifyModal").modal('show');
		
	});
	
}




